package com.boomsecret.date;

import com.boomsecret.utils.DateUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by wangjinliang on 2018/8/10.
 */
public class CalendarDemo {
    public static final String DEFAULT_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static void main(String[] args) {
        System.out.println(dateToString(DateUtils.getCurrentDayZeroTime(), DEFAULT_TIME_FORMAT));
        System.out.println(dateToString(DateUtils.getCurrentDayLastSecondTime(), DEFAULT_TIME_FORMAT));
    }

    public static String dateToString(Date date, String formart) {
        SimpleDateFormat sdf = new SimpleDateFormat(formart);
        if (date == null) {
            return "";
        }
        return sdf.format(date);
    }
}
